<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<sfa:mainTitle></sfa:mainTitle>
<%@ include file="/common/meta.jsp"%>
<script type="text/javascript">
	$(document).ready(function(){
		if("${msg}")
		alert("${msg}");
	});
</script>
<script type="text/javascript">
$(function() {
	$("#fullScreen").click(function() {
		fullScreen.FullScreen("mytable");
	});
})



$(function() {
	$(".deleteCustomer").click(function() {
		var saleHideCustomerId = $(this).attr("saleCustomerId");
		//alert(saleHideCustomerId);
		var url = "${path}/customer/manage/index/delete/" + saleHideCustomerId;
		art.dialog( {
			lock : true,
			content : '确定要删除吗?',
			ok : function() {
				art.dialog( {
					id : "loading",
					lock : true,
					drag : false,
					resize : false,
					title : "正在删除...",
					time:5
				});
				$.post(url, null, function(result) {
					art.dialog( {
						id : 'loading'
					}).close();//关闭等待框
						if (result.result) {
							art.dialog( {
								icon : "succeed",
								content : "删除成功!",
								lock : true,
								ok : function() {
									location.reload();
								}
							});
						} else {
							art.dialog( {
								icon : "error",
								content : "删除失败!",
								lock : true,
								ok : true
							});
						}

					});

				return true;
			},
			cancelVal : '关闭',
			cancel : true
		//为true等价于function(){}
				});

	});

	
});

function doExport(type) {
	document.form1.action = "${path}/customer/manage/index/exportgetcustomers?type="+type;
	document.form1.submit();
}
</script>
	
</head>

<body id="master">

	<sfa:mainHeader></sfa:mainHeader>
	
	 <!--右边-->
            <div class="webpart3 contentarea">
                <div class="webpart-head">
                    <div class="webpart-head-item">
                       客户查询
                        <div class="tools-btn" style="width: 250px;">
                        		 <a href="${path}/customer/manage/index/addcustomer"><span>
                                <img src="${path}/statics/images/add2.gif" style="margin-right: 4px;" />新建</span></a>
                             	<a href="####" id="fullScreen"><span>
                                <img src="${path}/statics/images/qp.gif" style="margin-right: 4px; margin-bottom: -3px;" />全屏</span></a></div>
                    </div>
                </div>
                <div class="webpart-main">
                    <div class="webpart-main-item" style="padding-top: 12px;">
                        <div class="search">
                            <!----------- 查询信息 ------------------>
                            <form name="form1" method="post" action="${path}/customer/manage/index/getcustomers">
                            <table cellpadding="0" cellspacing="0">
                                <tr>
                                    <th>
                                        开始日期：
                                    </th>
                                    <td>
                                        <input id="beginCreateDate" name="beginCreateDate" type="text"
										onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate input-txt" readOnly="true"
										value="${beginCreateDate}"/>
                                    </td>
                                    <th>
                                        结束日期:
                                    </th>
                                    <td>
                                        <input id="endCreateDate" name="endCreateDate" type="text"
										onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate input-txt" readOnly="true"
										value="${endCreateDate}"/>
                                    </td>
                                    <th>
                                       客户姓名:
                                    </th>
                                    <td>
                                       <input type="text" name="customerName" id="customerName"
										class="input-txt" value="${customerName}">
                                    </td>
                                    <td rowspan="2">
                                         
                                        
                                        <input type="submit" class="linkbtn2" value="查询" /><br/>
									<input type="button" class="linkbtn2" value="清空"
										onclick="location.href='${path}/customer/manage/index/getcustomers';" />
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        客户类型：
                                    </th>
                                    <td>
                                        <sfa:dic showType="select" kindNo="CUSTOMERTYPE"
										 attr="class='input-txt' style='width:130px'" def="ALL:全部;"
										name="customerType" id="customerType" code="${customerType}">
										</sfa:dic>
                                    </td>
                                    
                                    <th>
                                        联系人:
                                    </th>
                                    <td>
                                        <input type="text" name="contract" id="contract"
										class="input-txt" value="${contract}">
                                    </td>
                                    
                                </tr>
                                
                            </table>
                            </form>
                        </div>
                        <!----------- 数据列表 ------------------>
                        <table cellpadding="0" cellspacing="0" class="dg_borderstyle trStyleTable" style="margin-top: 15px;line-height: 23px;" id="mytable">
                            <tr>
	                            <th>
	                            序号
	                            </th>
                                <th>
                                    客户姓名
                                </th>
                                
                                <th>
                                    客户地址
                                </th>
                                 
                                <th>
                                    客户类型
                                </th>
                                <th>
                  	联系人
                                </th>
                                <th>
                                    创建时间
                                </th>
                                <th>
                                    操作
                                </th>
                                
                               
                            </tr>
                            <c:forEach items="${pagination.resultList}" var="customer" varStatus="ind">
						<tr  >
							<td>
								${(pagination.page-1)*10+(ind.index+1)}
							</td>
							 <td>
								<span><a href="${path}/customer/manage/index/show?saleCustomerId=${customer.saleCustomerId}">${customer.customerName}</a></span>
							</td> 
							<td>
								<span>${customer.customerAddr }</span>
							</td>
							 
							<td>
								<span><sfa:dic showType="value"
										 code="${customer.customerType }">
										</sfa:dic></span>
							</td> 
							<td>
								<span>${customer.contract }</span>
							</td>
							<td>
								<span><fmt:formatDate value="${customer.createDate }" pattern="yyyy-MM-dd"/></span>
							</td>
							<td>
								<a
										href="${path}/customer/manage/index/show?saleCustomerId=${customer.saleCustomerId}">详情</a>
									<span class="v_line">| </span>
									<a
										href="${path}/customer/manage/index/updatecustomer/${customer.saleCustomerId}">编辑</a>
									<span class="v_line">| </span>
									<a href="javascript:void(0);" class="deleteCustomer"
										saleCustomerId="${customer.saleCustomerId}">删除</a>
							</td>
							 </tr>
						</c:forEach>
                        </table>
                      
                
                 <!----------- 翻页导航 ------------------>
                        <div class="dg_pagerstyle">
                            <div class="pageinfo">
                                第${pagination.page }页 | 共${pagination.totalPages }页/${pagination.totalRows }条记录
                            </div>
                            <div class="pagebtn">
                                ${pagination.multiPage}&nbsp;
                            </div>
                        </div>
                
            </div>
            </div>
            <div class="webpart-foot">
                    <div class="webpart-foot-item">
                    </div>
                </div>
            </div>
	
	 
	<sfa:mainFooter></sfa:mainFooter>

</body>
</html>


